package com.example.demo.mapper;

import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * 对用户表进行操作
 * @Author:王子健
 * @date:2019-12-25
 */
@Mapper
public interface UserMapper {
    /*添加用户*/
    @Insert("insert into user(id,appid,username,password,createtime)values(#{id},#{appid},#{username},#{password},#{createtime})")
     int insertUser(User user);
    /*删除用户*/
    @Delete("delete from user where id = #{id}")
    int deleteUser(int id);
    /*修改用户信息*/
    @Update("update user set appid=#{appid},username=#{username},passwd=#{passwd},createtime=#{createtime} where id = #{id}")
    int updateUser(User user);

    /*查询所有用户信息*/
    @Select("select * from user")
    List<User> selectAllUsers();

}
